home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
5791
/
5791.xpi
/
chrome
/
flagfox.jar
/
content
/
preview.xul
< prev
next >
Wrap
Extensible Markup Language
|
2008-09-13
|
4KB
|
90 lines
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://flagfox/content/style.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://flagfox/locale/flagfox.dtd">
<window class="dialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="vertical"
autostretch="always"
onload="generate();"
title="&prefs.previewicons;">
<keyset>
<key keycode="VK_ESCAPE" oncommand="window.close();"/>
</keyset>
<stringbundleset>
<stringbundle id="flagfox-countrynames" src="chrome://flagfox/locale/countrynames.properties"/>
</stringbundleset>
<script type="application/x-javascript" src="chrome://flagfox/content/util.js"/>
<script type="application/x-javascript">
<![CDATA[
const FLAGS_PER_ROW = 20;
const EXCLUDE_PREVIEWS = "-A,-B,-C,-L,A1,A2";
var countrynames = null;
function generate()
{
try
{
countrynames = document.getElementById("flagfox-countrynames");
//var time1 = new Date().getTime();
document.getElementById("preview1").appendChild(spawnset("flagset1"));
document.getElementById("preview2").appendChild(spawnset("flagset2"));
//var time2 = new Date().getTime();
//document.getElementById("loadtimer").setAttribute("value",(time2-time1)+"ms");
}
catch (e) { Flagfox_error("Failed to generate preview",e); }
}
function spawnset(set)
{
const srcroot = "chrome://flagfox/content/icons/" + set + "/";
const nsIPE = Components.interfaces.nsIPropertyElement;
var setbox = document.createElement("vbox");
var enumerator = countrynames.strings;
while (enumerator.hasMoreElements())
{
var linebox = document.createElement("hbox");
linebox.setAttribute("width",18*FLAGS_PER_ROW);
linebox.setAttribute("height",12);
var i=0, country, image;
while (i<FLAGS_PER_ROW && enumerator.hasMoreElements())
{
country = enumerator.getNext().QueryInterface(nsIPE);
if (EXCLUDE_PREVIEWS.indexOf(country.key) == -1)
{
image = document.createElement("image");
image.setAttribute("src", srcroot + country.key.toLowerCase() + ".png");
image.setAttribute("tooltiptext", country.value);
image.setAttribute("onclick", "Flagfox_addTabInCurrentBrowser(Flagfox_getWikipediaSearchURL('" + country.value + "'));" );
image.setAttribute("style", "cursor: pointer;");
linebox.appendChild(image);
++i;
}
}
setbox.appendChild(linebox);
}
return setbox;
}
]]>
</script>
<groupbox id="preview1">
<caption label="&prefs.previewset1;"/>
</groupbox>
<groupbox id="preview2">
<caption label="&prefs.previewset2;"/>
</groupbox>
<hbox>
<spacer flex="1"/>
<text id="loadtimer" style="font-style: italic; font-size: smaller;"/>
<spacer flex="5"/>
<button label="&close;" oncommand="window.close();" default="true" />
</hbox>
</window>